<template>
  <transition name="slide">
    <div v-if="isToastShow" class="toast">{{message}}</div>
  </transition>
</template>

<script>
export default {
  name: 'popUp',
  data() {
    return {
      isToastShow: true,
    };
  },
  methods: {
    timeout() {
      const self = this;
      setTimeout(() => {
        self.isToastShow = false;
      }, 500);
    },
  },
  mounted() {
    this.timeout();
  },
};
</script>

<style scoped>
  .toast{
    min-width: 3rem;
    max-width: 8rem;
    margin: auto;
    background: #969696;
    color: #fff;
    text-align: center;
    height: 1.58666667rem;
    line-height: 1.58666667rem;
    border-radius: 3px;
    position: absolute;
    left: 0;
    top: -1rem;
    right: 0;
    bottom: 0;
  }
  .slide-enter{
    opacity: 0;
    /*top: -40px;*/
  }
  .slide-enter-active{
    transition: all .5s ease-in-out;
  }
  .slide-enter-to{
    opacity: 1;
    /*top: 100px;*/
  }
  .slide-leave{
    opacity: 1;
    /*top: 100px;*/
  }
  .slide-leave-active{
    transition: all .5s ease-in-out;
  }
  .slide-leave-to{
    opacity: 0;
    /*top: -40px;*/
  }
</style>
